return -1;
}
-#define VMX_FEATURE_FLAG 0x20
-
-static int vmx_identify(void)
-{
- int eax, ecx;
-
- __asm__ __volatile__ (
-#if defined(__i386__)
- "push %%ebx; cpuid; pop %%ebx"
-#elif defined(__x86_64__)
- "push %%rbx; cpuid; pop %%rbx"
-#endif
- : "=a" (eax), "=c" (ecx)
- : "0" (1)
- : "dx");
-
- if (!(ecx & VMX_FEATURE_FLAG)) {
- return -1;
- }
-
- return 0;
-}
-
int xc_vmx_build(int xc_handle,
uint32_t domid,
int memsize,
unsigned long nr_pages;
char *image = NULL;
unsigned long image_size;
+ xen_capabilities_info_t xen_caps;
+
+ if ( (rc = xc_version(xc_handle, XENVER_capabilities, &xen_caps)) != 0 )
+ {
+ PERROR("Failed to get xen version info");
+ goto error_out;
+ }
- if ( vmx_identify() < 0 )
+ if ( !strstr(xen_caps, "hvm") )
{
- PERROR("CPU doesn't support VMX Extensions");
+ PERROR("CPU doesn't support VMX Extensions or "
+ "CPU VMX Extensions are not turned on");
goto error_out;
}
def configure(self, imageConfig, deviceConfig):
ImageHandler.configure(self, imageConfig, deviceConfig)
+ info = xc.xeninfo()
+ if not 'hvm' in info['xen_caps']:
+ raise VmError("vmx: not an Intel VT platform, we stop creating!")
+
self.dmargs = self.parseDeviceModelArgs(imageConfig, deviceConfig)
self.device_model = sxp.child_value(imageConfig, 'device_model')
if not self.device_model:
#include <xen/console.h>
#include <xen/elf.h>
#include <asm/vmx.h>
-#include <asm/vmx_vmcs.h>
#include <asm/msr.h>
#include <asm/physdev.h>
#include <xen/kernel.h>
((c->user_regs.ss & 3) == 0) )
return -EINVAL;
}
+ else if ( !hvm_enabled )
+ return -EINVAL;
clear_bit(_VCPUF_fpu_initialised, &v->vcpu_flags);
if ( c->flags & VGCF_I387_VALID )